<template>
    <div class="left-nav">
        <el-menu style="height: 100%;" default-active="1" @select="handleSelectChanged" class="el-menu-vertical-demo">
            <el-menu-item index="1">
                <template slot="title">
                    <i class="el-icon-pie-chart"></i>
                    <span>总览</span>
                </template>
            </el-menu-item>
            <el-menu-item index="2">
                <template slot="title">
                    <i class="el-icon-data-analysis"></i>
                    <span>数据维护</span>
                </template>
            </el-menu-item>
            <el-menu-item index="3">
                <template slot="title">
                    <i class="el-icon-upload"></i>
                    <span>导入</span>
                </template>
            </el-menu-item>
        </el-menu>
    </div>
</template>

<script>
export default {
    data() {
        return {
            index: 1
        }
    },
    methods: {
        handleSelectChanged(data) {
            this.index = data;
            //把事件发布到外部
            this.$emit('menu-selected-changed', data);
        }
    }
}
</script>

<style scoped>
.left-nav {
    text-align: left;
    height: 100%;
}
</style>